<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>es6 解构</title>
</head>
<body>
<script>
    let person = {
        name: "abc",
        gender: "男",
        age: 18
    }

    /*
       // 常见写法
       let name = person.name;
       let gender = person.gender;
       let age = person.age;

       console.log(name);
       console.log(gender);
       console.log(age);
   */

    /*
        // 解构——按照顺序解构所有内容
        let {name, gender, age} = person
        console.log(name);
        console.log(gender);
        console.log(age);
    */

    /*
    // 解构——解构部分内容
    let {name, age} = person
    console.log(name);
    console.log(age);
*/

    // 解构——不按照顺序解构部分内容
    let {age,name } = person
    console.log(name);
    console.log(age);

</script>
</body>
</html>